package com.wuliang.generate.bean.entities.datasource;

import com.google.gson.annotations.Expose;
import com.wuliang.generate.common.core.basic.BasicEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Lazy;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author 邬魉
 */
@Data
@Lazy
@Entity
@Builder
@Cacheable
@ApiModel("表")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table(name = "t_datasource_column", schema = "wuliang_generate_datasource")
public class DatasourceColumn extends BasicEntity {

    @Expose
    @Column(name = "table_id", columnDefinition = "int unsigned comment '归属于哪张表'")
    @ApiModelProperty(name = "tableId", value = "归属于哪张表")
    private Integer tableId;

    @Expose
    @Column(name = "column_name", columnDefinition = "varchar(255) default '' comment '字段名称'")
    @ApiModelProperty(name = "columnName", value = "字段名称")
    private String columnName;

    @Expose
    @Column(name = "column_default_value", columnDefinition = "varchar(255) default '' comment '字段默认值'")
    @ApiModelProperty(name = "columnDefaultValue", value = "字段默认值")
    private String columnDefaultValue;

    @Expose
    @Column(name = "column_nullable", columnDefinition = "tinyint      default 0 comment '是否可以为空(0: 是; 1：否)'")
    @ApiModelProperty(name = "columnNullable", value = "是否可以为空(0: 是; 1：否)")
    private Integer columnNullable;

    @Expose
    @Column(name = "column_type", columnDefinition = "varchar(255) default '' comment '字段类型'")
    @ApiModelProperty(name = "columnType", value = "字段类型")
    private String columnType;

    @Expose
    @Column(name = "column_length", columnDefinition = "int unsigned default 0 comment '字段最大长度'")
    @ApiModelProperty(name = "columnLength", value = "字段最大长度")
    private Integer columnLength;

    @Expose
    @Column(name = "column_charter", columnDefinition = "varchar(255) default 'utf8' comment '字段值编码'")
    @ApiModelProperty(name = "columnCharter", value = "字段值编码")
    private String columnCharter;

    @Expose
    @Column(name = "column_collate", columnDefinition = "varchar(255) default 'utf8_bin' comment '编码引擎'")
    @ApiModelProperty(name = "columnCollate", value = "编码引擎")
    private String columnCollate;

    @Expose
    @Column(name = "column_key", columnDefinition = "varchar(255) default '' comment '什么类型的key'")
    @ApiModelProperty(name = "columnKey", value = "什么类型的key")
    private String columnKey;

    @Expose
    @Column(name = "column_extra", columnDefinition = "varchar(255) default '' comment '附属选项'")
    @ApiModelProperty(name = "columnExtra", value = "附属选项")
    private String columnExtra;

    @Expose
    @Column(name = "column_comment", columnDefinition = "varchar(255) default '' comment '字段说明'")
    @ApiModelProperty(name = "columnComment", value = "字段说明")
    private String columnComment;

}
